import {Constants} from 'expo';

//const URL_USER_SERVER = 'http://127.0.0.1/user-server';
//const URL_RESOURCE_SERVER = 'http://127.0.0.1/resource-server';
//const URL_BLOG = 'http://127.0.0.1/blog';
//const URL_EDU = 'http://127.0.0.1/edu';
//const URL_MSG = 'http://127.0.0.1/msg';
//const WS_MSG = 'ws://127.0.0.1/msg/ws';
//const SOCK_JS_MSG = 'http://127.0.0.1/msg/ws/sockjs';

const URL_USER_SERVER = 'https://www.j1kj.cn/user-server';
const URL_RESOURCE_SERVER = 'https://www.j1kj.cn/resource-server';
const URL_BLOG = 'https://www.j1kj.cn/blog';
const URL_EDU = 'https://www.j1kj.cn/edu';
const URL_MSG = 'https://www.j1kj.cn/msg';
const WS_MSG = 'wss://www.j1kj.cn/msg/ws';
const SOCK_JS_MSG = 'https://www.j1kj.cn/msg/ws/sockjs';

const ENV = 'debug';
//const ENV = 'produced';

const WS_CHANNEL_EDU_CHAT = 1;

const DEFAULT_ICON_URL = 'https://www.j1kj.cn/file/2018-01-16/62707166309519360_thumbnail.jpg';
const DEFAULT_ICON_ID = 62707166309519360;

const THEME_COLOR_1 = '#F0FFF5';
const THEME_COLOR_2 = '#DAF5E4';
const THEME_COLOR_3 = '#A9E8C4';
const THEME_COLOR_4 = '#7DDBA7';
const THEME_COLOR_5 = '#55CF90';
const THEME_COLOR_6 = '#31C37C';
const THEME_COLOR_7 = '#1F9C64';
const THEME_COLOR_8 = '#12754C';
const THEME_COLOR_9 = '#084F34';
const THEME_COLOR_10 = '#04291C';

function autoUrl(pre, api) {
    return pre + api;
}

function userServer(api) {
    return autoUrl(URL_USER_SERVER, api);
}

function resourceServer(api) {
    return autoUrl(URL_RESOURCE_SERVER, api);
}

function blog(api) {
    return autoUrl(URL_BLOG, api);
}

function edu(api) {
    return autoUrl(URL_EDU, api);
}

function msg(api) {
    return autoUrl(URL_MSG, api);
}

function wsMsg() {
    return WS_MSG;
}

function debug() {
    return ENV === 'debug';
}

function wsChannelEduChat() {
	return WS_CHANNEL_EDU_CHAT;
}

function defaultIconUrl() {
	return DEFAULT_ICON_URL;
}

function defaultIconId() {
	return DEFAULT_ICON_ID;
}

function themeColor(lv) {
	switch (lv){
		case 1:
			return THEME_COLOR_1;
		case 21:
			return THEME_COLOR_2;
		case 3:
			return THEME_COLOR_3;
		case 4:
			return THEME_COLOR_4;
		case 5:
			return THEME_COLOR_5;
		case 6:
			return THEME_COLOR_6;
		case 7:
			return THEME_COLOR_7;
		case 8:
			return THEME_COLOR_8;
		case 9:
			return THEME_COLOR_9;
		case 10:
			return THEME_COLOR_10;
	}
	return THEME_COLOR_6;
}

function themTextColor() {
	return '#ffffff';
}

export {
    userServer,
    resourceServer,
    blog,
    edu,
    msg,
    wsMsg,
    debug,
    wsChannelEduChat,
    defaultIconUrl,
    defaultIconId,
    themeColor,
    themTextColor,
    Constants,
}